<template>
	<view class="" style="padding: 30rpx;">
		<view class="" style="display: flex;align-items: center;justify-content: space-between;">
			<view class="" style="width: 100%;">
				<u-search placeholder=" " v-model="form.keyword" :show-action="false" @search="getMemorandumList()"></u-search>
			</view>
		</view>
		<view class="" style="display: flex;justify-content: space-between;align-items: center;padding: 30rpx 0;">
			<view class="" style="">
				<view style="display: flex;align-items: center;">
					<text style="width: 120rpx;">时间:</text>
					<u-input v-model="form.remindDate" :type="type" :border="border" disabled placeholder=" " @click="show=true" style="flex: 1;"></u-input>
				</view>
				<u-picker mode="time" v-model="show" :params="params" @confirm="confirm"></u-picker>
			</view>
			<view class="" style="margin-left: 20rpx;">
				<u-button type="primary" :custom-style="customStyle" @click="toAdd">
					<view class="" style="font-size: 26rpx;">
						+新增备忘录
					</view>
				</u-button>
			</view>
		</view>
		<view class="">
			<view class="" style="display: flex;justify-content: space-between;align-items: center;margin-top: 30rpx;" v-for="(item,index) in memorandumList">
				<view style="height: 100%;width: 100%;background-color: #f5f7fb;border-radius: 20rpx;padding: 20rpx;">
					<view class="" style="display: flex;justify-content: space-between;border-bottom: 1rpx solid #d5d7da;padding: 20rpx 0;">
						<view class="" style="display: flex;">
							<img src="../../static/img/ream.png" alt="" style="width: 40rpx;height: 40rpx;min-height: 40rpx;min-width: 40rpx;" />
							<view class="" style="margin-left: 30rpx;">
								<view class="" style="width: 450rpx;;font-weight: bold;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;">
									{{item.title}}
								</view>
								<view class="" style="font-size: 24rpx;color: #898b8f;margin-top: 10rpx;">
									{{item.remindDate}}
								</view>
							</view>
						</view>
						<view class="">
							<image src="../../static/img/yb.png" mode="" style="width: 80rpx;height: 80rpx;" v-if="item.level == 1"></image>
							<image src="../../static/img/jj.png" mode="" style="width: 80rpx;height: 80rpx;" v-if="item.level == 2"></image>
						</view>
					</view>
					<view class="" style="padding: 20rpx;">
						<view class="" style="height: 192rpx;overflow: hidden;text-overflow: ellipsis;color: #898b8f;">
							{{item.content}}
						</view>
						<view class="" style="display: flex;justify-content: center;height: 30rpx;margin-top: 20rpx;">
							<text style="color: #2b85e4;text-decoration: underline;" @click="toDetail(item)">查看详情</text>
						</view>
					</view>
				</view>
				<!-- <view style="height: 100%;width: 100%;background-color: #f5f7fb;border-radius: 20rpx;padding: 20rpx;">
					<view class="" style="display: flex;justify-content: space-between;border-bottom: 1rpx solid #d5d7da;padding: 20rpx 0;">
						<view class="" style="display: flex;">
							<img src="../../static/img/ream.png" alt="" style="width: 40rpx;height: 40rpx;" />
							<view class="" style="margin-left: 30rpx;">
								<view class="" style="font-weight: bold;">
									{{item.title}}
								</view>
								<view class="" style="font-size: 24rpx;color: #c8c9cd;">
									{{item.remindDate}}
								</view>
							</view>
						</view>
						<view class="">
							<image src="../../static/img/yb.png" mode="" style="width: 80rpx;height: 80rpx;" v-if="item.level == 1"></image>
							<image src="../../static/img/jj.png" mode="" style="width: 80rpx;height: 80rpx;" v-if="item.level == 2"></image>
						</view>
					</view>
					<view class="" style="padding: 20rpx;height: 70%;">
						<view class="" style="height: 200rpx;">
							{{item.content}}
						</view>
						<view class="" style="display: flex;justify-content: center;">
							<text style="color: #2b85e4;" @click="toDetail(item)">查看详情</text>
						</view>
					</view>
				</view> -->
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				form:{
					page:1,
					pageSize:100,
					keyword:'',
					remindDate:''
				},
				memorandum:{},
				memorandumList:[],
				type: 'text',
				border: true,
				params: {
					year: true,
					month: true,
					day: false,
					hour: false,
					minute: false,
					second: false
				},
				show: false,
				keyword: ' ',
				scrollTop: 0,
				customStyle: {
					height:'70rpx'
				},
			}
		},
		onShow() {
			this.getMemorandumList()
		},
		methods: {
			confirm(e) {
				console.log(e);
				this.form.remindDate = e.year + '-' + e.month
				console.log(this.form.remindDate)
				this.getMemorandumList()
			},
			async getMemorandumList(){
				const res = await this.$api.MemorandumList(this.form)
				console.log(res)
				if(res.code==1){
					this.memorandum = res.data
					this.memorandumList = this.memorandum.data
				}else{
					this.$refs.uToast.show({
						title: res.msg,
						type: 'error'
					})
				}
			},
			toDetail(item){
				uni.navigateTo({
					url:'/pages/memorandum/memorandumDetail?id='+item.id
				})
			},
			onPageScroll(e) {
				this.scrollTop = e.scrollTop;
			},
			toAdd(){
				uni.navigateTo({
					url:'/pages/memorandum/add'
				})
			},
			
			// toDetail(item){
			// 	uni.navigateTo({
			// 		url:'/pages/memorandum/memorandumDetail?id='+item.id
			// 	})
			// }
		}
		
	}
</script>

<style lang="scss" scoped>
	.list-cell {
		display: flex;
		box-sizing: border-box;
		width: 100%;
		padding: 10px 24rpx;
		overflow: hidden;
		color: #323233;
		font-size: 14px;
		line-height: 24px;
		background-color: #fff;
	}
	.uni-margin-wrap {
			width: 690rpx;
			width: 100%;
		}
		.swiper {
			height: 500rpx;
		}
		.swiper-item {
			display: block;
			height: 500rpx;
			line-height: 500rpx;
			text-align: center;
		}
		.swiper-list {
			margin-top: 40rpx;
			margin-bottom: 0;
		}
		.uni-common-mt {
			margin-top: 60rpx;
			position: relative;
		}
		.info {
			position: absolute;
			right: 20rpx;
		}
		.uni-padding-wrap {
			width: 550rpx;
			padding: 0 100rpx;
		}
</style>